package com.guigu.order.feign;

import com.guigu.tms.result.R;
import com.guigu.work.dto.TaskPickupDispatchDTO;
import com.guigu.work.dto.TransportOrderDTO;
import com.guigu.work.entity.TaskPickupDispatch;
import com.guigu.work.entity.TransportOrder;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @ClassName:TransportOrderFegin
 * @Description://TODO
 * @Author:taoLong
 * @Date:2021/11/15:17:07 星期一
 * @email:2391611102@qq.com or 2391611102qq@gmail.com
 */
@FeignClient(value = "tms-work")
public interface WorkFeign {

    /**
     * 新增运单
     *
     * @param dto 运单信息
     * @return 运单信息
     */
    @ApiOperation("新增运单")
    @PostMapping("/transport-order/save")
    public R<TransportOrder> save(@RequestBody TransportOrderDTO dto);


    /**
     * 根据多个条件获取运单信息
     *
     * @param dto
     * @return
     */
    @GetMapping("/transport-order/list")
    public R<TransportOrder> list(TransportOrderDTO dto);

    /**
     * 根据订单id查找它的运单信息
     *
     * @param orderId
     * @return
     */
    @GetMapping("/transport-order/getByOrderId/{orderId}")
    public R<TransportOrder> getByOrderId(@PathVariable("orderId") String orderId);

    /**
     * 新增取派件任务
     *
     * @param dto 取派件任务信息
     * @return 存储结果
     */
    @ApiOperation(value = "新增取派件任务", notes = "基本属性无ID")
    @PostMapping("/task-pickup-dispatch/save")
    public R save(@RequestBody TaskPickupDispatchDTO dto);

    /**
     * 根据订单id获取取派件任务信息
     *
     * @param orderId 订单Id
     * @return 任务详情
     */
    @ApiOperation(value = "根据订单id获取取派件任务信息", notes = "订单ID&任务类型-1取件任务|2-派件任务")
    @GetMapping("/task-pickup-dispatch/orderId/{orderId}/{taskType}")
    public R<TaskPickupDispatch> findByOrderId(@PathVariable("orderId") String orderId, @PathVariable("taskType") Integer taskType);
}
